package com.doit.demo.day02.transformations;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @DATE 2022/2/15/22:53
 * @Author MDK
 * @Version 2021.2.2
 * 对DataStream的数据进行过滤
 * 使用lambda表达式
 **/
public class FilterDemo2 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<String> lines = env.socketTextStream("linux01", 8888);
        SingleOutputStreamOperator<String> filtered = lines.filter(line->!line.startsWith("h"));

        filtered.print();
        env.execute();
    }
}
